<template>
	<text @tap.stop="copyToClipboard" class="copyAction">复制</text>
</template>

<script>
  /* 
    带有点击复制功能的按钮
  */
	export default {
    props: {
      content: {
        type: String,
        default: '未设置内容'
      } // 将要复制的内容文本
    },
    methods: {
      copyToClipboard () { // 复制到剪切板
        uni.setClipboardData({
          data: this.content,
          success (res) {
            console.log(res) // data
          }
        })
      }
    }
  }
</script>

<style>
  .copyAction {
    padding: 5upx 25upx;
    border-radius: 25upx;
    font-size: 24upx;
    color: #666666;
    margin-left: 20upx;
    border: 1upx solid #979797;
  }
</style>
